const express = require("express");
const app = express();

const myLogger = (req, res) => {
  console.log(req.method, req.url, Date.now());
};

app.use((req, res, next) => {
  req.foo = "bar";
  res.abc = () => {
    console.log("abc");
  };
  console.log(req.method, req.url, Date.now());
  next();
});

app.get("/", (req, res) => {
  console.log(req.foo);
  res.abc();
  res.send("get /");
});

app.get("/about", (req, res) => {
  res.send("get about");
});

app.post("/login", (req, res) => {
  res.send("post login");
});

app.listen(3000, () => {
  console.log("server is running at http://localhost:3000");
});
